<?php
/*
Primary Author: Derek Shue
Secondary: Alex Arey
Documentation: Cheng Yi
Updated: 12/10/2011
Module Description: The Students module adds/finds/updates/deletes Students from the database.
*/
class Application_Model_DbTable_Students extends Zend_Db_Table_Abstract
{

    protected $_name = 'STUDENTS';

    public function getStudent($where)
    {

        $row = $this->fetchRow($where);
        if (!$row) {
            throw new Exception("Could not find row $where");
        }
        return $row->toArray();
    }

    public function addStudent($id,$pid, $firstname, $middlename, $lastname, $email, $phone, $major, $studentstate, $howhear)
    {
        $data = array(
            'ID' => $id,
            'PID' => $pid,
			'FIRSTNAME' => $firstname,
			'MIDDLENAME' => $middlename,
			'LASTNAME' => $lastname,
			'EMAIL' => $email,
			'PHONE' => $phone,
			'MAJOR' => $major,
			'STUDENTSTATE' => $studentstate,
			'HOWHEAR' => $howhear,


        );
        $this->insert($data);
    }

    public function updateStudent($id,$pid, $firstname, $middlename, $lastname, $email, $phone, $major, $studentstate, $howhear)
    {
        $data = array(
            'ID' => $id,
            'PID' => $pid,
			'FIRSTNAME' => $firstname,
			'MIDDLENAME' => $middlename,
			'LASTNAME' => $lastname,
			'EMAIL' => $email,
			'PHONE' => $phone,
			'MAJOR' => $major,
			'STUDENTSTATE' => $studentstate,
			'HOWHEAR' => $howhear,
        );
		$data = array_filter($data);
        $this->update($data, 'ID = '. (int)$id);
    }

    public function deleteStudent($where)
    {
        $this->delete($where);
    }


/*
IDNUMBER
PIDNUMBER
FIRSTNAMEVARCHAR2
MIDDLENAMEVARCHAR2
LASTNAMEVARCHAR2
EMAILVARCHAR2
PHONEVARCHAR2
MAJORVARCHAR2
STUDENTSTATEVARCHAR2
HOWHEARVARCHAR2
*/

}





























































































































